using I2.Loc;
using UnityEngine;

public class MapInfo : MonoBehaviour
{
	public GameObject selectMap;

	public UILabel lbNameMap;

	public GameObject arrow;

	public UITexture levelPreview;

	public LevelsInfo curLevel;

	public MapPopularity popularity;

	public UILabel labelPopularity;

	public GameObject fewSprite;

	public GameObject manySprite;

	public GameObject plentySprite;

	public GameObject lotsSprite;

	public ManagerSelectMap controlMap;

	[HideInInspector]
	public string nameForSort;

	private void Start()
	{
		if (controlMap == null)
		{
			controlMap = base.transform.GetComponentInParent<ManagerSelectMap>();
		}
	}

	private void OnEnable()
	{
		if (string.IsNullOrEmpty(nameForSort))
		{
			nameForSort = base.gameObject.name;
		}
		if (!(ManagerPVPLevels.instance != null))
		{
			return;
		}
		if (lbNameMap != null)
		{
			lbNameMap.text = curLevel.nameLevel;
		}
		if (!(arrow != null))
		{
			return;
		}
		if (ManagerMissions.currMission != null)
		{
			if (!ManagerMissions.currMission.offlineMission && ManagerMissions.currMission.nameScene == curLevel.nameScene)
			{
				arrow.SetActive(true);
			}
			else
			{
				arrow.SetActive(false);
			}
		}
		else
		{
			arrow.SetActive(false);
		}
	}

	public void SetPopularityInfo()
	{
		if (labelPopularity != null)
		{
			labelPopularity.gameObject.SetActive(true);
			fewSprite.SetActive(false);
			manySprite.SetActive(false);
			plentySprite.SetActive(false);
			lotsSprite.SetActive(false);
			labelPopularity.text = ManagerPVPLevels.instance.CheckMapPopularityMessage(popularity);
			switch (popularity)
			{
			case MapPopularity.Few:
				labelPopularity.text = ScriptLocalization.Get("PVP_map_info/lb_Popularity_Few");
				fewSprite.SetActive(true);
				return;
			case MapPopularity.Many:
				labelPopularity.text = ScriptLocalization.Get("PVP_map_info/lb_Popularity_Many");
				manySprite.SetActive(true);
				return;
			case MapPopularity.Plenty:
				labelPopularity.text = ScriptLocalization.Get("PVP_map_info/lb_Popularity_Plenty");
				plentySprite.SetActive(true);
				return;
			case MapPopularity.Lots:
				labelPopularity.text = ScriptLocalization.Get("PVP_map_info/lb_Popularity_Lots");
				lotsSprite.SetActive(true);
				return;
			}
			BCWDebug.Log("Somting wrong with " + base.name + " " + popularity);
		}
	}

	public void SetSelectionMap(bool val)
	{
		selectMap.SetActive(val);
	}

	private void OnClick()
	{
	}
}
